<template>
    <div>
        <!-- 图片块 -->
        <div class="goods-image">
            <img :src="infoObj.url" alt="">
        </div>
        <!-- 价格 快递 销量 块 -->
        <div class="good-name">
            <div class="good-namedetails">
                {{infoObj.desc}}
            </div>
            <div class="good-price">
                <div class="good-price-new">￥{{infoObj.price}}</div>
                <div class="good-price-old">￥459</div>
            </div>
            <div class="good-miscellaneous">
                <div class="kuaidi">快递：免邮费</div>
                <div class="haopinglv">好评率：98%</div>
                <div class="xialiang">销量：2589</div>
            </div>
        </div>
        <!-- 选择规格块 -->
        <div class="choose-specifications">
            <div class="xuanzeguige">选择规格</div>
            <div class="icon-next" @click="goto">
                <i class="el-icon-arrow-right"></i>
            </div>
        </div>

        <!-- 用户评价 -->
        <div class="user-evaluation">
            <div class="evaluation">
                <div class="evaluation-num">用户评价（999+）</div>
                <div class="evaluation-per">98%好评</div>
                <div class="evaluation-next" @click="gotoUserE"><i class="el-icon-arrow-right"></i></div>
            </div>
            <div class="underline"></div>
            <div class="evaluation-detail">
                <!-- 头像 -->
                <div class="user-headPortrait">
                    <img src="../../../../assets/images/swiper3.jpg" alt="">
                </div>
                <!-- 评价 -->
                <div class="user-information">
                    <div class="userNameAndTime">
                        <div class="userName">用户122321</div>
                        <div class="userTime">01月06日 15:49</div>
                    </div>
                    <div class="stars"><span>★</span><span>★</span><span>★</span><span>★</span></div>
                    <div class="user-content">
                        好评好评！这真的是一款好产品，不管是颜色还是价格都很好，强雷推荐给大家！
                    </div>
                    <div class="user-image">
                        <div class="user-image-shiji">
                            <img src="../../../../assets/images/swiper3.jpg" alt="">
                        </div>
                       <!-- 遍历 -->
                        
                    </div>
                </div>
            </div>
            <div class="underline-more"></div>
            <!-- 查看更多 -->
            <div class="see-more">
                <p>查看更多</p>
            </div>
        </div>
        <!-- 单品推荐 -->
        <ShoppingRec :recArr='recArr'/>

        <!-- 底部 加入购物车 客服 收藏 购物车 -->
        <div class="bottom-nav">
            <div class="bottom-nav-icon">
                <div class="customer-service">
                    <div class="customer-service-icon">
                        <i class="el-icon-service"></i>
                    </div>
                    <div class="customer-service-chinese">
                        <p>客服</p>
                    </div>
                </div>
                <div class="collection">
                    <div class="collection-icon">
                        <i class="el-icon-star-off"></i>
                    </div>
                    <div class="collection-chinese">
                        <p>收藏</p>
                    </div>
                </div>
                <div class="shoppingCar">
                    <div class="shoppingCar-icon">
                        <i class="el-icon-shopping-cart-2"></i>
                    </div>
                    <div class="shoppingCar-chinese">
                        <p>购物车</p>
                    </div>
                </div>
            </div>
            <div class="bottom-nav-addToShoppingCar">
                <p>加入购物车</p>
            </div>
        </div>
    </div>
</template>

<script>
import ShoppingRec from '../ShoppingRec.vue'
import api from '../../../../api'


export default {
    name:'Goods',
    data(){
        return{
            infoObj:{},
            recArr:[]
        }
    },
    components:{
        ShoppingRec
    },
    methods:{
        goto(){
            this.$router.push('/goodsDetailsLayout/color')
        },
        gotoUserE(){
            this.$router.push('/userEvaluation')
        }
    },
    mounted(){
        console.log(this.$route.params.obj);
        var info=this.$route.params.obj;
        if(typeof(info)==typeof({})){
            this.infoObj=info;
            localStorage.setItem('infoObj',JSON.stringify(this.$route.params.obj));
        }else{
            this.infoObj=JSON.parse(localStorage.getItem('infoObj'));
        }
        
        // 推荐
        api.getRecommend().then(res=>{
            //console.log(res.data.list);
            this.recArr=res.data.list;
        })
    },
    watch:{
        infoObj(val,newval){
            console.log(val);
            console.log(newval)
        }
    }
}
</script>

<style lang='less' scoped>
.goods-image{
    width: 100%;
    height: 174px;
    margin-top: 7px;
    img{
        width: 100%;
        height: 100%;
    }
}
.good-name{
    width:100%;
    box-sizing: border-box;
    height: 136px;
    padding: 8px 12px 13px;
    background-color: white;
    .good-namedetails{
        width: 100%;
        height: 46px;
        line-height: 23px;
        color: rgba(16, 16, 16, 1);
        font-size: 16px;
        text-align: left;
        font-family: Arial;
        margin-bottom: 8px;
    }
    .good-price{
        width: 100%;
        height: 29px;
        margin-bottom: 9px;
        position: relative;
        .good-price-new{
            width: 54px;
            height: 29px;
            line-height: 29px;
            color: rgba(242, 61, 82, 1);
            font-size: 20px;
            text-align: center;
            font-family: Arial;
            float: left;
        }
        .good-price-old{
            line-height: 17px;
            color: rgba(153, 153, 153, 1);
            font-size: 12px;
            text-align: center;
            font-family: Arial;
            float: left;
            margin-left: 10px;
            position: absolute;
            bottom: 0;
            left: 55px;
            text-decoration:line-through
        }
    }
}
.good-miscellaneous{
    width: 100%;
    height: 23px;
    display: flex;
    .kuaidi{
        flex: 1;
        width: 73px;
        height: 23px;
        line-height: 23px;
        color: rgba(153, 153, 153, 1);
        font-size: 12px;
        text-align: left;
        font-family: Arial;
    }
    .haopinglv{
        flex: 1;
        width: 73px;
        height: 23px;
        line-height: 23px;
        color: rgba(153, 153, 153, 1);
        font-size: 12px;
        text-align: center;
        font-family: Arial;
    }
    .xialiang{
        flex: 1;
        width: 64px;
        height: 23px;
        line-height: 23px;
        color: rgba(153, 153, 153, 1);
        font-size: 12px;
        text-align: right;
        font-family: Arial;
    }
}
.choose-specifications{
    width:100%;
    height: 50px;
    background-color: white;
    box-sizing: border-box;
    padding:14px 12px 13px 14px;
    margin-top: 7px;
    margin-bottom: 7px;
    .xuanzeguige{
        width: 57px;
        height: 23px;
        line-height: 23px;
        color: rgba(16, 16, 16, 1);
        font-size: 14px;
        text-align: center;
        font-family: Arial;
        float: left;
    }
    .icon-next{
        line-height: 23px;
        float: right;
        font-size: 23px;
    }
}
.user-evaluation{
    width: 100%;
    height: 303px;
    box-sizing: border-box;
    padding: 14px 12px 0 14px;
    background-color: white;
    position: relative;
    .evaluation{
        width: 100%;
        height: 23px;
        margin-bottom: 8px;
        position: relative;
        .evaluation-num{
            width: 117px;
            height: 23px;
            line-height: 23px;
            color: rgba(16, 16, 16, 1);
            font-size: 14px;
            text-align: center;
            font-family: Arial;
            float: left;
        }
        .evaluation-per{
            width: 49px;
            height: 23px;
            line-height: 23px;
            color: rgba(153, 153, 153, 1);
            font-size: 12px;
            text-align: center;
            font-family: Arial;
            position: absolute;
            right: 25px;
        }
        .evaluation-next{
            width: 21px;
            height: 21px;
            line-height: 21px;
            font-size: 21px;
            position: absolute;
            right: 0;
        }
    }
}
.underline{
    width: 100%;
    height: 1px;
    background-color: #F3F4F5 ;
}
.evaluation-detail{
    width: 100%;
    min-height: 100px;
    margin-top: 12px;
    .user-headPortrait{
        width:42px;
        height: 42px;
        border-radius: 50%;
        float: left;
        margin-right: 9px;
        img{
            width:100%;
            height:100%;
            border-radius: 50%;
        }
    }
    .user-information{
        float: left;
        width: 295px;
        min-height:100px ;
        .userNameAndTime{
            width: 100%;
            height: 23px;
            margin-bottom: 4px;
            .userName{
                width: 65px;
                height: 23px;
                line-height: 23px;
                color: rgba(102, 102, 102, 1);
                font-size: 12px;
                text-align: center;
                font-family: Arial;
                float: left;
            }
            .userTime{
                width: 85px;
                height: 23px;
                line-height: 23px;
                color: rgba(153, 153, 153, 1);
                font-size: 12px;
                text-align: center;
                font-family: Arial;
                float: right;
            }
        }
        .stars{
            width: 100%;
            height: 12px;
            font-size: 12px;
            line-height: 12px;
            span{
                margin-right: 0px;
            }
        }
        .user-content{
            width: 295px;
            height: 40px;
            line-height: 20px;
            color: rgba(16, 16, 16, 1);
            font-size: 14px;
            text-align: left;
            font-family: Arial;
            margin-top: 12px;
        }
        .user-image{
            width: 100%;
            height: 67px;
            margin-top: 13px;
            margin-bottom: 13px;
            .user-image-shiji{
                width: 67px;
                height: 67px;
                margin-right: 9px;
                float: left;
                img{
                    width:100%;
                    height: 100%;
                }
            }
            div:last-child{
                margin-right: 0;
            }
            
        }
        
    }
}
.underline-more{
    width: 93%;
    height: 1px;
    background-color: #F3F4F5;
    position: absolute;
    top:251px;
}
.see-more{
    width: 80px;
    height: 40px;
    line-height: 40px;
    color: rgba(102, 102, 102, 1);
    text-align: center;
    font-family: Arial;
    position: absolute;
    bottom: 5px;
    left: 50%;
    margin-left: -40px;
    p{
        font-size: 14px;
    }
}
.content-title{
    width: 57px;
    height: 23px;
    line-height: 23px;
    margin: 17px auto 7.5px;
    text-align: center;
    font-family: Arial;
    p{
        font-size: 14px;
        color: rgba(16, 16, 16, 1);
    }
}
.bottom-nav{
    width: 100%;
    height: 49px;
    margin-top: 56px;
    background-color: white;
    .bottom-nav-icon{
        width: 214px;
        height: 100%;
        float: left;
        display: flex;
        flex-wrap: wrap;
        .customer-service{
            flex:0 0 33.33%;
            position: relative;
            .customer-service-icon{
                width: 24px;
                height: 24px;
                position: absolute;
                top: 4px;
                left:50%;
                margin-left: -12px;
                i{
                    font-size: 26px;
                    font-weight: 800;
                }
            }
            .customer-service-chinese{
                width: 26px;
                height: 21px;
                line-height: 21px;
                text-align: center;
                font-family: Arial;
                position: absolute;
                bottom: 0;
                left: 50%;
                margin-left:-13px; 
                p{
                    font-size: 10px;
                    color: rgba(16, 16, 16, 1);
                }
            }
        }
        .collection{
            flex:0 0 33.33%;
            position: relative;
            .collection-icon{
                width: 24px;
                height: 24px;
                position: absolute;
                top: 4px;
                left:50%;
                margin-left: -12px;
                i{
                    font-size: 26px;
                    font-weight: 800;
                }
            }
            .collection-chinese{
                width: 26px;
                height: 21px;
                line-height: 21px;
                text-align: center;
                font-family: Arial;
                position: absolute;
                bottom: 0;
                left: 50%;
                margin-left:-13px; 
                p{
                    font-size: 10px;
                    color: rgba(16, 16, 16, 1);
                }
            }
        }
        .shoppingCar{
            flex:0 0 33.33%;
            position: relative;
            .shoppingCar-icon{
                width: 24px;
                height: 24px;
                position: absolute;
                top: 4px;
                left:50%;
                margin-left: -14px;
                i{
                    font-size: 26px;
                    font-weight: 800;
                }
            }
            .shoppingCar-chinese{
                width: 40px;
                height: 21px;
                line-height: 21px;
                text-align: center;
                font-family: Arial;
                position: absolute;
                bottom: 0;
                left: 50%;
                margin-left:-20px; 
                p{
                    font-size: 10px;
                    color: rgba(16, 16, 16, 1);
                }
            }
        
        }
    }
    .bottom-nav-addToShoppingCar{
        width: 161px;
        height: 49px;
        background-color: #D9D9D9;
        float: right;
        text-align: center;
        line-height: 49px;
        p{
            font-size: 16px;
            color:rgba(16, 16, 16, 1);
        }
    }
}
</style>
